<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Classificados</title>
</head>
<body>
	<f:view>

<h2>Classificados</h2>
<p>
	<h:outputText value="#{classificados.msg}" style="color: #FF0000"></h:outputText>
	<h:outputText value="#{cadastro.msg}"  style="color: #FF0000"></h:outputText>
</p>
Informe login e senha para entrar no sistema.
	
		<h:form>
			<h:panelGrid border="1" columns="2">
				<h:outputText value="Login: "></h:outputText>
				<h:inputText value="#{classificados.login}"></h:inputText>
				<h:outputText value="Senha: "></h:outputText>
				<h:inputSecret value="#{classificados.senha}"></h:inputSecret>
			</h:panelGrid>
			<h:commandButton value="Efetuar Login" action="#{classificados.autentica}"></h:commandButton>
		</h:form>

		<h:form>
			<h:commandLink action="cadastro">
				<h:outputText value="Efetue o seu cadastro!"></h:outputText>
			</h:commandLink>
		</h:form>
		
	<p>
	<h2>Anúncios publicados: </h2>
	</p>
	
	<h:dataTable border="1" id="lista" value="#{classificados.anuncios}" var="an">
			<h:column id="column1">
				<f:facet name="header"> <h:outputText value="Descrição" /></f:facet>
				<h:outputText value="#{an.descricao}" />
			</h:column>
			<h:column id="column2">
				<f:facet name="header"><h:outputText value="Valor" /></f:facet>
				 <h:outputText value="#{an.valor}" /> 
			</h:column>
			<h:column id="column3">
			<h:form>
				<h:commandLink action="detalhe_anuncio" value="detalhes">
    				<f:param name="id" value="#{an.id}" />
				</h:commandLink>
			</h:form>
			</h:column>
		</h:dataTable>
		
	</f:view>
</body>
</html>